{template 'common'}
<input type="hidden" name="reply_id" value="{$reply['id']}" />
<div class="panel panel-default">
    <div class="panel-heading">
        活动设置
    </div>
    <div class="panel-body">
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动名称</label>
            <div class="col-sm-9 col-xs-12">
               	<input type="text" id="title" class="form-control" placeholder="" name="title" value="{$reply['title']}">
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动图片</label>
            <div class="col-sm-9 col-xs-12">
               	{php echo tpl_form_field_image('thumb',$reply['thumb']);}
            </div>
        </div>
        
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动说明</label>
            <div class="col-sm-9 col-xs-12">
               	<textarea style="height:60px;" id='description' name="description" class="form-control" cols="60">{$reply['description']}</textarea>
            </div>
        </div>
        
           <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动时间</label>
            <div class="col-sm-9 col-xs-12">
            
               	{php echo tpl_form_field_daterange('datelimit', array('starttime'=>date('Y-m-d',$reply['starttime']),'endtime'=>date('Y-m-d',$reply['endtime'])))}
            </div>
        </div>
        
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 兑奖信息</label>
            <div class="col-sm-9 col-xs-12">
               		<input type="text" id="ticket_information" class="form-control" placeholder="" name="ticket_information" value="{$reply['ticket_information']}">
                                       <div class="help-block">例如: 兑奖请联系我们，电话 13xxxxxxxxx</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">版权信息</label>
            <div class="col-sm-9 col-xs-12">
                    <input type="text" id="copyright" class="form-control" placeholder="" name="copyright" value="{$reply['copyright']}">
		<div class="help-block">版权信息，如果不填写，默认为公众号名称！</div>
            </div>
        </div>
        
    </div>
</div>
<div class="panel panel-default">
    <div class="panel-heading">
        样式设置
    </div>
    <div class="panel-body">
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">顶部图片</label>
            <div class="col-sm-9 col-xs-12">
               	{php echo tpl_form_field_image('toppic',$reply['toppic']);}
            </div>
        </div>
           <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">背景颜色</label>
            <div class="col-sm-9 col-xs-12">
               	{php echo tpl_form_field_color('bgcolor',empty($reply['bgcolor'])?'#ca1a48':$reply['bgcolor']);}
            </div>
        </div>
          <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">文字颜色</label>
            <div class="col-sm-9 col-xs-12">
               	{php echo tpl_form_field_color('fontcolor',empty($reply['fontcolor'])?'#fff':$reply['fontcolor']);}
                    <span class="help-block">页面文字颜色</span>
            </div>
        </div>
          <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">按钮颜色</label>
            <div class="col-sm-9 col-xs-12">
               	{php echo tpl_form_field_color('btncolor',empty($reply['btncolor'])?'#f2cb0e':$reply['btncolor']);}
                    <span class="help-block">页面参加活动及助力按钮颜色</span>
            </div>
        </div>
        
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">按钮文字颜色</label>
            <div class="col-sm-9 col-xs-12">
               	{php echo tpl_form_field_color('btnfontcolor',empty($reply['btnfontcolor'])?'#333':$reply['btnfontcolor']);}
                    <span class="help-block">页面参加活动及助力按钮的文字颜色</span>
            </div>
        </div>
        
        
    </div>
</div>


<div class="panel panel-default">
    <div class="panel-heading">
        详细设置
    </div>
    <div class="panel-body">
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>活动类型</label>
            <div class="col-sm-9 col-xs-12">
                  <label class=" radio-inline">
                        <input type="radio" name="type" value="0" {if $reply['type'] == 0} checked="checked"{/if}/>
                               集分
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="type" value="1" {if $reply['type'] == 1} checked="checked"{/if}/>
                               集钱
                    </label>
                    <span class="help-block">集分: 整数形式 集钱: 2位小数</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>奖品设置</label>
            <div class="col-sm-9 col-xs-12">
                <div class="alert alert-block alert-new" style='width:500px;'>
                        <table class='table'>
                            <thead>
                                <tr>
                                    <th>点数(大于此点数)</th>
                                    <th>奖品名称</th>
                                    <th>奖品数量</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="award-items">
                                {loop $awards $award}
                                <tr class='award_item'>
                                    <td><input  name="award_point[]" type="text" class="form-control span2" value="{$award['point']}"  maxlength="50"/></td>
                                    <td><input  name="award_name[]" type="text" class="form-control span2" value="{$award['name']}" maxlength="10"  style="width:100px;"/></td>
                                    <td><input  name="award_num[]" type="text" class="form-control span2" value="{$award['num']}"  maxlength="50"/></td>
                                    <td>
                                        <input  name="award_id[]" type="hidden" value="{$award['id']}" />
                                        <a href='javascript:;' onclick='removeAward(this)'><i class='icon icon-remove fa fa-times'></i> 删除</a>
                                    </td>
                                </tr>
                                {/loop}
                                
                            </tbody>
                           
                        </table>
                    </div>
                <a href="javascript:;" onclick="addAward();"><i class="fa fa-plus" title="添加奖品"></i> 添加奖品</a>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>默认助力范围</label>
            <div class="col-sm-9 col-xs-12">
            
                  <input  name="start" type="text" class="form-control input-small " value="{$reply['start']}"  maxlength="50" style='width:100px;'/> 
                  到
                          <input  name="end" type="text" class="form-control input-small" value="{$reply['end']}"  maxlength="50"  style='width:100px;'/> 
                          <span class="help-block">参加活动默认的范围，或者后续助力没有助力规则时候的范围，如果固定，则两个设置成一样</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>助力规则</label>
            <div class="col-sm-9 col-xs-12">
                
                <div class="alert alert-block alert-new" style='width:500px;'>
                        <table class='table'>
                            <thead>
                                <tr>
                                    <th>点数(大于此点数)</th>
                                    <th>助力范围从</th>
                                    <th>到</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="rule-items">
                                {loop $rules $rule}
                                <tr class='rule_item'>
                                    <td><input  name="rule_point[]" type="text" class="form-control span3" value="{$rule['point']}"  maxlength="50"/></td>
                                    <td>
                                        <input  name="rule_start[]" type="text" class="form-control span1" value="{$rule['start']}"  maxlength="50"/> </td>
                                        <td><input  name="rule_end[]" type="text" class="form-control span1" value="{$rule['end']}"  maxlength="50"/></td>
                                      <td>
                                            <input  name="rule_id[]" type="hidden" value="{$rule['id']}" />
                                        <a href='javascript:;' onclick='removeRule(this)'><i class='icon icon-remove fa fa-times'></i> 删除</a>
                                    </td>
                                </tr>
                                {/loop}
                                
                            </tbody>
                        </table>
                        
                    </div>
                 <a href="javascript:;" onclick="addRule();"><i class="fa fa-plus" title="添加规则"></i> 添加规则</a>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>助力次数限制</label>
            <div class="col-sm-9" style="margin-top:5px;">    
                 <div class="input-group col-sm-4" style="float:left">
                        <span class="input-group-addon">总共被助力</span>
                        <input type="text" class="form-control span1" name="self_times" value="{$reply['self_times']}" />
                        <span class="input-group-addon">次</span>
                    </div>
                <div class="input-group col-sm-4" style="float:left">
                        <span class="input-group-addon">每天被助力</span>
                        <input type="text" class="form-control span1" name="self_day_times" value="{$reply['self_day_times']}" />
                        <span class="input-group-addon">次</span>
                </div>
            </div>
        </div>
         <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
              <div class="col-sm-9 col-xs-12" style="margin-top:5px;">    
                  <div class="input-group col-sm-4" style="float:left">
                        <span class="input-group-addon">总共助力别人</span>
                        <input type="text" class="form-control span1" name="other_times" value="{$reply['other_times']}" />
                        <span class="input-group-addon">次</span>
                    </div>
                <div class="input-group col-sm-4" style="float:left">
                        <span class="input-group-addon">每天助力别人</span>
                        <input type="text" class="form-control span1" name="other_day_times" value="{$reply['other_day_times']}" />
                        <span class="input-group-addon">次</span>
                </div>
              </div>
         </div>
             <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                  <div class="col-sm-9 col-xs-12" style="margin-top:5px;">    
                 <div class="input-group  col-sm-4" style="float:left">
                        <span class="input-group-addon">总共助力相同用户</span>
                        <input type="text" class="form-control span1" name="other_one_times" value="{$reply['other_one_times']}" />
                        <span class="input-group-addon">次</span>
                    </div>
                <div class="input-group   col-sm-4" style="float:left">
                        <span class="input-group-addon">每天助力相同用户</span>
                        <input type="text" class="form-control span1" name="other_one_day_times" value="{$reply['other_one_day_times']}" />
                        <span class="input-group-addon">次</span>
                </div>
                  </div>
                
               
            </div>
      
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>手机号重命名</label>
            <div class="col-sm-9 col-xs-12">
                    <input type="text" id="tel_rename" class="form-control span7" placeholder="" name="tel_rename" value="{if empty($reply['tel_rename'])}手机号{else}{$reply['tel_rename']}{/if}">
                    <div class="help-block">例如：QQ号,微信号,手机号,邮寄地址! 不懂请默认设置手机号! 此字段主要收集用户的信息方便联系</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>活动提醒</label>
            <div class="col-sm-9 col-xs-12">
                   <input type="text" id="tips" class="form-control span7" placeholder="" name="tips" value="{if empty($reply['tips'])}奖品有限，快快参加!{else}{$reply['tips']}{/if}">
                    <div class="help-block">例如：奖品有限，快快参加!</div>
            </div>
        </div>
          <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>信息提示</label>
            <div class="col-sm-9 col-xs-12">
                  <input type="text" id="tel_rename" class="form-control span7" placeholder="" name="info_tips" value="{if empty($reply['info_tips'])}已经获得了 [P] [U] !{else}{$reply['info_tips']}{/if}">
                    <div class="help-block">例如：您已经获取了 [P] [U] ! [P]标签为获得的数值 [U]标签为数值单位</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>数值单位</label>
            <div class="col-sm-9 col-xs-12">
                 <input type="text" id="unit" class="form-control span7" placeholder="" name="unit" value="{if empty($reply['unit'])}分{else}{$reply['unit']}{/if}">
                    <div class="help-block">获得的数值的单位，例如：分，元等，与信息提示组合成“已经获取了 n 分!" </div>
            </div>
        </div>
          <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>助力按钮文字</label>
            <div class="col-sm-9 col-xs-12">
                  <input type="text" id="tel_rename" class="form-control span7" placeholder="" name="help_tips" value="{if empty($reply['help_tips'])}给 TA 助力{else}{$reply['help_tips']}{/if}">
                    <div class="help-block">例如: 给 TA 助力</div>
            </div>
        </div>
  
          <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>参与按钮文字</label>
            <div class="col-sm-9 col-xs-12">
                   <input type="text" id="tel_rename" class="form-control span7" placeholder="" name="join_tips" value="{if empty($reply['join_tips'])}我要参加活动{else}{$reply['join_tips']}{/if}">
                    <div class="help-block">例如: 我要参加活动</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>邀请提示</label>
            <div class="col-sm-9 col-xs-12">
                  <input type="text" id="invite_tips" class="form-control span7" placeholder="" name="invite_tips" value="{if empty($reply['invite_tips'])}邀请好友助力{else}{$reply['invite_tips']}{/if}">
                    <div class="help-block">例如：邀请好友助力</div>
            </div>
        </div>
            <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>排名提示</label>
            <div class="col-sm-9 col-xs-12">
                  <input type="text" id="rank_tips" class="form-control span7" placeholder="" name="rank_tips" value="{if empty($reply['rank_tips'])}好友排名{else}{$reply['rank_tips']}{/if}">
                    <div class="help-block">例如：好友排名</div>
            </div>
        </div>
              <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>排名数</label>
            
                    <div class="col-sm-5">
                        <div class="input-group" >
                        <input type="text" class="form-control span1" name="rank_num" value="{$reply['rank_num']}" />
                        <span class="input-group-addon">名之前</span>
                    </div>
                    </div>
          
        </div>
        
       
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>参与方法</label>
            <div class="col-sm-9 col-xs-12">
                 <textarea style="height:200px; width:100%;" id='joincontent' class="form-control span7 richtext" name="joincontent" cols="70">{$reply['joincontent']}</textarea>
                 <span class="help-block">未关注的粉丝，点击我要参加活动显示 的内容! </span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>参与方法连接</label>
            <div class="col-sm-9 col-xs-12">
                     <input type="text" id="share_url" class="form-control span7" placeholder="" name="share_url" value="{$reply['share_url']}">
                    <div class="help-block">未关注的粉丝，点击我要参加活动跳转的连接，如果填写连接，会跳转到此连接,转成短地址。<a target="_blank" href="http://www.dwz.cn/">短网址转换</a></div>
            </div>
        </div>
     
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>活动规则</label>
            <div class="col-sm-9 col-xs-12">
                <textarea style="height:200px; width:100%;" id='content' class="form-control span7 richtext" name="content" cols="70">{$reply['content']}</textarea>
            </div>
        </div>
            <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>活动结束说明</label>
            <div class="col-sm-9 col-xs-12">
                  <textarea style="height:200px; width:100%;" id='overcontent' class="form-control span7 richtext" name="overcontent" cols="70">{$reply['overcontent']}</textarea>
                 <span class="help-block">活动结束时，粉丝进入页面的说明 ，在此页面可以查询自己是否中奖! </span>
            </div>
        </div>
        
            <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>显示奖品数量</label>
            <div class="col-sm-9 col-xs-12">
                   <label class="radio-inline">
                        <input type="radio" name="show_num" value="1" {if $reply['show_num'] == 1} checked="checked"{/if}/>
                               显示
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="show_num" value="0" {if $reply['show_num'] == 0} checked="checked"{/if}/>
                               不显示
                    </label>
            </div>
        </div>
            <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>显示排名</label>
            <div class="col-sm-9 col-xs-12">
                   <label class="radio-inline">
                        <input type="radio" name="show_rank" value="1" {if $reply['show_rank'] == 1} checked="checked"{/if}/>
                               显示
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="show_rank" value="0" {if $reply['show_rank'] == 0} checked="checked"{/if}/>
                               不显示
                    </label>
            </div>
        </div>
        
    </div>
</div>
 

<div class="panel panel-default">
    <div class="panel-heading">
        分享设置
    </div>
    <div class="panel-body">
           <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享标题</label>
            <div class="col-sm-9 col-xs-12">
                  <input type="text" id="share_title" class="form-control span7" placeholder="" name="share_title" value="{$reply['share_title']}">
            <div class="help-block">分享的文字，用户显示分享给用户的介绍!</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享描述</label>
            <div class="col-sm-9 col-xs-12">
                 <textarea style="height:60px;" name="share_desc" class="form-control span7" cols="60">{$reply['share_desc']}</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享说明</label>
            <div class="col-sm-9 col-xs-12">
             <textarea style="height:200px; width:100%;" id='share_txt' class="form-control span7 richtext-clone" name="share_txt" cols="70">{$reply['share_txt']}</textarea>
            <span class="help-block">如分享地址为空，则显示这里文字，分享后用户需关注公共号,才可以参加活动! </span>
            </div>
        </div>
        </div>
</div>
 
<script>
    $('form').submit(function() {

        if ($("#title").isEmpty()) {
            Tip.focus("title", "请输入活动名称!", "right");
            return false;
        }
        if($(".award_item").length<=0){
           alert('至少添加一个奖品!');
           return false;
        }
        if ($("#tel_rename").isEmpty()) {
            Tip.focus("tel_rename", "请输入手机号重命名!", "right");
            return false;
        }
        return true;
    });
    
      require(['jquery', 'util'], function($, u){
		$(function(){
			u.editor($('#content')[0]);
                        u.editor($('#overcontent')[0]);
                        u.editor($('#joincontent')[0]);
                        u.editor($('#share_txt')[0]);
                        
		});
      });
document.getElementById("we7_ValidCode_server").value=we7_ValidCode_server;	    
</script>


<script language='javascript'>
    function addRule(){
        
        var html = " <tr class='rule_item'>";
        html+="<td><input  name='rule_point[]' type='text' class='form-control span2' value=''  maxlength='50'/></td>";
        html+="<td><input  name='rule_start[]' type='text' class='form-control span1' value=''  maxlength='50'/></td>";
        html+="<td><input  name='rule_end[]' type='text' class='form-control span1' value=''  maxlength='50'/></td>";
        html+="<td>";
                    html+="<input  name='rule_id[]' type='hidden' value='' />";
                    html+="<a href='javascript:;' onclick='removeRule(this)'><i class='icon icon-remove fa fa-times'></i> 删除</a>";
                    html+="</td>";
                    html+="</tr>";
                    $("#rule-items").append(html);
                                
    }
    function removeRule(obj){
        $(obj).parent().parent().remove();
    }
    function addAward(){
              var html = " <tr class='award_item'>";
                    html+="<td><input  name='award_point[]' type='text' class='form-control span2' value=''  maxlength='50'/></td>";
                    html+="<td><input  name='award_name[]' type='text' class='form-control span2' value=''  maxlength='50'/></td> ";
                    html+="<td><input  name='award_num[]' type='text' class='form-control span2' value=''  maxlength='3'/></td>";
                    html+="<td>";
                                            html+="<input  name='award_id[]' type='hidden' value='' />";
                                        html+="<a href='javascript:;' onclick='removeAward(this)'><i class='icon icon-remove fa fa-times'></i> 删除</a>";
                                    html+="</td>";
                                html+="</tr>";
                                $("#award-items").append(html);
    }
    function removeAward(obj){
        $(obj).parent().parent().remove();
    }
    </script>